package com.mvc.model;


import com.jfinal.plugin.activerecord.Model;

/**  
 * 用户
 * 
 */

public class User extends Model<User>{
	/**
	 * 
	 */
	private static final long serialVersionUID = 7249422659364463861L;

	/***
	 * 表字段
	 *
	 */
	public static interface TableField {
		String ID = "id";
		String TYPE = "type";
		String MONEY = "money";
		String SEX = "sex";
		String CODE = "code";
		String USER = "user";
		String NAME = "name";
		String PWD = "pwd";
		String HEAD = "head";
		String EMAIL = "email";
		String MAC = "mac";
		String DEVICETYPE = "deviceType";
		String VIPSTARTTIME = "vipstarttime";
		String VIPENDTIME = "vipendtime";
		String SIGNSIZE ="signSize";
		String SIGNDATE ="signDate";
	}
	public static final User dao = new User();
	
	public User findLoginUser(String username, String userpassword) {
		String sql = "select * from user where user=? and pwd=?" ;
		return dao.findFirst(sql, username,userpassword);
	}
	
	/***
	 * 根据账号获取用户
	 * @param username
	 * @return
	 */
	public User findUserByName(String username) {
		String sql = "select * from user where user=?" ;
		return dao.findFirst(sql, username);
	}
	
}
